#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <unordered_map>
using namespace std;
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target)
    {
        unordered_map<int, int> unmap;
        vector<int> ret(2, 0);
        for (int i = 0;i < nums.size();++i)
        {
            unmap.insert(make_pair(nums[i], i));
        }
        for (int i = 0;i < nums.size();++i)
        {
            auto it = unmap.find(target - nums[i]);
            if (it == unmap.end())
            {
                continue;
            }
            if (it->second == i)
            {
                continue;
            }
            ret[0] = i;
            ret[1] = it->second;
            return ret;
        }
        return ret;
    }
};